package fr.univ.lille1.android.network;

import retrofit.RestAdapter;

/**
 * Singleton factory to retrieve an instance of the Rest adapter of the library
 * Retrofit. This is used by managers of the application.
 * 
 * @author Gerard
 */
public final class RequestFactory {
	/**
	 * Base URL of the API of the server.
	 */
	private static final String API_URL = "http://tagthis.fil.univ-lille1.fr:8080/TagThis";
	/**
	 * Static instance of the factory.
	 */
	private static final RequestFactory INSTANCE = new RequestFactory();
	/**
	 * Rest adapter of the library retrofit.
	 */
	private final RestAdapter mRestAdapter;

	/**
	 * Constructor of the factory who initialize rest adapter of the library
	 * retrofit.
	 */
	private RequestFactory() {
		mRestAdapter = new RestAdapter.Builder().setServer(API_URL).build();
	}

	/**
	 * Get unique instance of the class.
	 * 
	 * @return RequestFactory instance
	 */
	public static RequestFactory getInstance() {
		return INSTANCE;
	}

	/**
	 * Get rest adapter of retrofit
	 * 
	 * @return RestAdapter
	 */
	public RestAdapter getRestAdapter() {
		return mRestAdapter;
	}
}
